home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nejlepší hry
/
Nejlepsi hry.iso
/
hry
/
sea of chaos
/
sea_install.msi
/
_15C39AAA7726369D39812BD40F01CF6A
/
_663DC9746F1C446B8A5C2D6CB144FA3C
< prev
next >
Wrap
Text File
|
2005-03-08
|
1KB
|
66 lines
//sky vertex shader:
//moves texture coordinates with time
//generates textures coordinates for 1 layer
//Luke Lenhart
//(C)2004-2005 Digipen Institute of Technology
//brightness of sky
float4 skyColor;
//translucency to draw layer at
float alpha;
//world,view,projection transform
float4x4 matWorldViewProj;
//current time (in seconds) since whenever
float curTime;
//shader input
struct VS_INPUT
{
float4 Pos : POSITION;
float2 Tex0 : TEXCOORD0;
};
//shader output
struct VS_OUTPUT
{
float4 Pos : POSITION;
float4 Color : COLOR;
float2 Tex0 : TEXCOORD0;
};
//shader code
VS_OUTPUT VShader(VS_INPUT In)
{
VS_OUTPUT Out;
//calc transformed position
Out.Pos=mul(matWorldViewProj,In.Pos);
float2 postxt=float2(In.Pos.x,In.Pos.y);
Out.Tex0=postxt*1.0f+float2(curTime*-.07,curTime*.03);
//make vert color
Out.Color=skyColor;
Out.Color.a=1.0f;
//if z is near 0, fade it out
if (In.Pos.z<=0.0f)
{
Out.Color.a=0.0f;
}
else if (In.Pos.z<0.05f)
{
Out.Color.a=0.35f;
}
//apply alpha parameter
Out.Color.a*=alpha;
//spit out the results
return Out;
}